<?php
$player = $game->player_get_uinfo();
if ( isset($_POST['cmd2']) ){
    $cmd2 = $_POST['cmd2'];

    switch ($cmd2){
        case "send_all":

            $msg = $_POST['msg'];
            $msg = htmlspecialchars($msg);
            $game->liaotian_send_all($msg , $player->uname , $player->uid );
            break;

    }

}

$链接_刷新聊天 = $game->create_url("cmd=liaotian&ltlx=all","刷新聊天");
$链接_私聊 = $game->create_url("cmd=liaotian&ltlx=im","私聊");
$链接_消息列表 = "";

if ($arr_data->ltlx == "all"){

    $obj_liaotian_all = $game->liaotian_get_all(10);

    if ($obj_liaotian_all){

        for ($i=0;$i < count($obj_liaotian_all);$i++){
            $ltObj = $obj_liaotian_all[count($obj_liaotian_all) - $i-1];
            $date = $ltObj->date;
            $date = date_create($date);
            $date = date_format($date,'H:i:s');
            $ucmd = $game->create_url("cmd=otherzhuangtai&cmd2=playerinfo&uid={$ltObj->uid}","{$ltObj->name}");

            if ($ltObj->uid){
                $链接_消息列表 .= "[公共][$date]{$ucmd}:{$ltObj->msg}<br/>";
            }else{
                $链接_消息列表 .= "[公共][$date]<div class='hpys' style='display: inline'>{$ltObj->name}:</div>{$ltObj->msg}<br/>";
            }

        }

    }
}

$发送聊天框="
<form method='post'>
<input type='hidden' name='cmd2' value='send_all'>
<label for='username' class='h5ui-form-label'>消息：</label>
<input type='text' name='msg' class='h5ui-form-input' placeholder='请输入发送的消息'>
<input type='submit' value='发送'>
</form>";

$html = "
聊天频道 {$链接_刷新聊天}<br/>
【公共|{$链接_私聊}】<br/>
{$链接_消息列表}
<br/>
{$发送聊天框}<br/>
{$变量_系统->链接_返回游戏}";

echo $html;
